package nix.servlet;

import java.io.IOException;
import java.util.Enumeration;

import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * GenericServlet的简单实现
 * 
 * @author berry
 * 
 */
public class MyGenericServlet implements Servlet {
	private ServletConfig config;

	public ServletConfig getConfig() {
		return this.config;
	}

	@Override
	public void destroy() {

	}

	@Override
	public ServletConfig getServletConfig() {
		return null;
	}

	@Override
	public String getServletInfo() {
		return "I am a Servlet!";
	}

	@Override
	public void init(ServletConfig servletConfig) throws ServletException {
		this.config = servletConfig;
		this.init();
	}

	public void init() {

	}

	@Override
	public void service(ServletRequest request, ServletResponse response)
			throws ServletException, IOException {

	}

	public ServletContext getServletContext() {
		return this.config.getServletContext();
	}

	public String getServletName() {
		return this.config.getServletName();
	}

	public String getInitParameter(String name) {
		return this.config.getInitParameter(name);
	}

	public Enumeration getInitParameterNames() {
		return this.config.getInitParameterNames();
	}
}
